import request from '../../utils/request';

// 产品标签管理相关 API

// 新增标签
export const createProductTag = (data: any) => {
    return request({
        url: '/product/api/tags',
        method: 'post',
        data
    });
};

// 根据标签ID获取标签
export const getProductTagById = (id: string) => {
    return request({
        url: `/product/api/tags/${id}`,
        method: 'get'
    });
};

// 更新标签
export const updateProductTag = (id: string, data: any) => {
    return request({
        url: `/product/api/tags/${id}`,
        method: 'put',
        data
    });
};

// 删除标签
export const deleteProductTag = (id: string) => {
    return request({
        url: `/product/api/tags/${id}`,
        method: 'delete'
    });
};

// 根据标签编码获取标签
export const getProductTagByCode = (tagCode: string) => {
    return request({
        url: `/product/api/tags/code/${tagCode}`,
        method: 'get'
    });
};

// 获取所有启用的标签
export const getEnabledProductTags = () => {
    return request({
        url: '/product/api/tags/enabled',
        method: 'get'
    });
};

// 分页查询标签列表
export const getProductTagPage = (params: any) => {
    return request({
        url: '/product/api/tags/page',
        method: 'get',
        params
    });
};
